package hoowin.basic.action;

import hoowin.basic.model.User;
import hoowin.basic.service.AccountService;

import com.opensymphony.xwork2.ActionSupport;

@SuppressWarnings("serial")
public class CreateInvitation extends ActionSupport {
	private AccountService accountService;
	private User user;
	private String message;
	private String email;
	public String execute(){
		if(email==null || email.length()==0){
			setMessage("Please input the email address you want to invite");
		}else{
			String info = accountService.saveInvitation(email, user);
			if(info.equals(SUCCESS))setMessage("Invitation has been sent out");
			else setMessage("Invitation has not bent sent");
		}
		return SUCCESS;
	}
	public void setAccountService(AccountService accountService) {
		this.accountService = accountService;
	}

	public AccountService getAccountService() {
		return accountService;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public String getMessage() {
		return message;
	}
	public void setUser(User user) {
		this.user = user;
	}
	public User getUser() {
		return user;
	}
	public void setEmail(String email) {
		this.email = email;
	}
}
